<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<shiro:hasPermission name="customer:select">
	<div class="content1">
		<div class="header">
			<h1 class="page-title">用户类型列表</h1>
			<ul class="breadcrumb">
				<li>用户管理</li>
				<li class="active">用户类型列表</li>
			</ul>
		</div>
		<div class="main-content">
			<div class="row">
				<div class="col-md-2">
					<div class="form-group">
						<div class="input-group">
							<div class="input-group-addon">手机号</div>
							<input class="form-control" type="text" id="phoneNum">
						</div>
					</div>
				</div>
					<div class="col-md-2">
					<div class="form-group">
						<div class="input-group">
							<div class="input-group-addon">用户注册来源</div>
							<select class="form-control" id="source">
								<option value="">--请选择--</option>
								<option value="1">iPhone</option>
								<option value="2">iPad</option>
								<option value="3">Android</option>
								<option value="4">微信</option>
								<option value="5">H5</option>
							</select>
						</div>
					</div>
				</div>
				
				<div class="col-md-2">
					<div class="form-group">
						<div class="input-group">
							<div class="input-group-addon">注册时间</div>
							<input class="form-control" type="date" id="createTime" name="startTime">
						</div>
					</div>
				</div>
				
				<div class="col-md-2">
					<div class="form-group">
						<div class="input-group">
							<div class="input-group-addon">状态</div>
							<select class="form-control" id="state">
								<option value="">--请选择--</option>
								<option value="1">正常</option>
								<option value="2">锁定</option>
								<option value="3">冻结</option>
							</select>
						</div>
					</div>
				</div>
				<div class="col-md-2">
					<button type="button" class="btn btn-primary btn-small btn-block"
						id="query">
						<i class="glyphicon glyphicon-search"></i> 查询
					</button>
				</div>
				
				<div class="col-md-1">	
					<div class="form-group">
						<a class="btn btn-primary btn-small btn-block" id="customer_export" onclick="exportMessage();">导出EXCEL表格</a>
					</div>				
				</div>
				
			</div>
			<table id="example" class="table"></table>
		</div>
		<script>
		function exportMessage(){
			var href="export/customerEcport.htm"
					+"?phoneNum="+$("#phoneNum").val()
					+"&phoneType="+$("#phoneType").val()
					+"&createTime="+$("#createTime").val()
					+"&source="+$("#source").val()
					+"&viewCode="+$("#viewCode").val()
					+"&state="+$("#state").val()
			$('#customer_export').attr("href",href);
		}
			//表格的初始化
			$(document).ready(function() {
				var table = $('#example').initTable({
					sAjaxSource:"customer/initTable.htm",
					aoColumns: [
			            { 
			              "data": "phoneNum",
			              "sTitle":"手机号",
			              'sClass':"text-center"
			            },
			            { 
				              "data": "phoneType",
				              "sTitle":"手机型号",
				              'sClass':"text-center",
				        },
		            	{ 
			              "data": "createTime",
			              "sTitle":"注册时间",
			              'sClass':"text-center"
			            },
			            { 
				              "data": "source",
				              "sTitle":"市场",
				              'sClass':"text-center",
				              "mRender": function(data, type, full) { 
				                	if(data == 1){
										return "<font>iPhone</font>";
									}else if(data == 2){
										return "<font>iPad</font>";
									}else if(data == 3){
										return "<font>Android</font>";
									}else if(data == 4){
										return "<font>微信</font>";
									}else if(data == 5){
										return "<font>H5</font>";
									}
				              } 
				         },
			           	{ 
				              "data": "viewCode",
				              "sTitle":"用户状态",
				              'sClass':"text-center",
				              "mRender": function(data, type, full) { 
				                	if(data == 20001){
										return "<font>默认</font>";
									}else if(data == 20002){
										return "<font>开户审核中</font>";
									}else if(data == 20003){
										return "<font>开户审核成功</font>";
									}else if(data == 20004){
										return "<font>开户审核不通过</font>";
									}else if(data == 20005){
										return "<font>提现界面</font>";
									}else if(data == 20006){
										return "<font>提现中</font>";
									}else if(data == 20007){
										return "<font>提现到帐</font>";
									}else if(data == 20008){
										return "<font>提现失败</font>";
									}else if(data == 20009){
										return "<font>还款界面</font>";
									}else if(data == 20010){
										return "<font>还款中</font>";
									}else if(data == 20011){
										return "<font>还款成功</font>";
									}else if(data == 20012){
										return "<font>还款失败</font>";
									}else if(data == 20013){
										return "<font>完善信息</font>";
									}else if(data == 20014){
										return "<font>完善信息</font>";
									}else if(data == 20015){
										return "<font>完善信息</font>";
									}else if(data == 20016){
										return "<font>完善信息</font>";
									}else if(data == 20017){
										return "<font>完善信息</font>";
									}
				                } 
				            },
				            { 
				                "data": "state",
				                "sTitle":"状态",
				                'sClass':"text-center",
				                "mRender": function(data, type, full) { 
				                	if(data == 1){
										return "<font>正常</font>";
									}else if(data == 2){
										return "<font color='blue'>锁定</font>";
									}else if(data == 3){
										return "<font color='red'>冻结</font>";
									}else{
										return "<font>未知</font>";
									}
				                } 
				            },
			         ],
					 fnServerParams: function (aoData) {  //查询条件
		             	aoData.push({ "name": "phoneNum", "value": $("#phoneNum").val() } );
		             	aoData.push({ "name": "source", "value": $("#source").val() } );
		             	aoData.push({ "name": "createTime", "value": $("#createTime").val() } );
		             	aoData.push({ "name": "state", "value": $("#state").val() } );
		             },
		              aoColumnDefs : [
 						<shiro:hasPermission name="customer:update or customer:delete">
		             	{"aTargets" :5,"mRender" : function(data, type, row){
		             		var edit="",del="";
 		                    return edit+"&nbsp;"+del;
 		                }
 		             }
 		            	</shiro:hasPermission>
		             ] 
				});
				
				 $('#query').click(function(){
					$('#example').dataTable().fnDraw();
				 });
			
			});
// 			//删除受影响的行数
// 			function deleteRow(id){
// 				console.log(id);
// 				$('#myModal').deleteRow('customer/del.htm?id='+id);
// 			}
// 			//增加或者修改受影响的行数
// 			function addAndUpdateRow(id){
// 				$('#insertAndUpdate').addAndUpdateRow("customer/addAndUpdateHome.htm?id="+id);
// 			}
			</script>
		<!---dialog选项-->
		<div>
			<jsp:include page="/WEB-INF/views/common/delete_dialog.jsp" />
			<jsp:include page="/WEB-INF/views/common/addupdate_dialog.jsp" />

			<div class="modal fade" id="insertAndUpdate" tabindex="-1"
				role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			</div>
		</div>
	</div>
</shiro:hasPermission>
<script type="text/javascript" src="resources/js/My97DatePicker/WdatePicker.js" charset="utf-8"></script>